<!DOCTYPE html>
<html>
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
	<meta name="apple-mobile-web-app-capable" content=true />
	<link rel="stylesheet" href="__PUBLIC__/com/jquery/jquery.mobile.min.css"/>
	<script src="__PUBLIC__/com/jquery/jquery.min.js"></script>
	<script src="__PUBLIC__/com/jquery/jquery.mobile.min.js"></script>
	<script src="__PUBLIC__/com/vue/vue.js"></script>
	<script src="__PUBLIC__/com/clipboard/clipboard.min.js"></script>
	<script src="__PUBLIC__/com/jsUtill/alert.js"></script>
	<script src="__PUBLIC__/com/jsUtill/timeFunc.js"></script>

	<meta charset="utf-8">
	<title>App</title>
</head>
<body>

	<div data-role="page" id="pageSet">
		<div data-role="header">
			<h1>{$title}</h1>
			<a href="__PUBLIC__/index/udid/index" target="new">获取UDID</a>
			<!-- <button onclick="togEdit()" data-inline="true"  style="padding: 0  5pt 0 5pt;position: absolute;top: -2px;right: 10pt;height: 30pt;font-size: 9pt;" >编辑</button> -->
		</div>
		<div data-role="content" class="app" id="app">

			<div class="cntapp">
				<div class="card" v-for="(item, key) in udids">
					

				 <p>设备：{{ item.devicename }}</p>
				 <p>UDID：{{ item.udid }}</p>
				 <p>IMEI:{{ item.imei }}</p>

				 <p>保存时间{{ dateFormat(new Date(item.savetime*1000)) }}</p> 
<!-- 
				 <p>devicename：{{ item.devicename }}</p>
				 <p>username{{ item.username }}</p>
				 <p>device{{ item.device }}</p>
				 <p>devicename：{{ item.devicename }}</p>
				 <p>deviceversion{{ item.deviceversion }}</p>
				 <p>system{{ item.system }}</p>
				 <p>udid{{ item.udid }}</p>
				 <p>imei{{ item.imei }}</p>
				 <p>savetime{{ item.savetime }}</p> -->
				 <div class="menu">
				 	
				 	<button @click="deleteData(item.id)" hidden="true" data-inline="true" class="btn_delete">删除</button>
				 	<!-- <button @click="editData(this,item.id)" hidden="true" data-inline="true" class="btn_Edit">编辑</button> -->
				 </div>
				</div>

			</div>

			<pre id="obj"></pre>
		</div>
		<div data-role="footer" style="display: none;">
			<h1>e6jpfei</h1>
		</div>
	</body>
	<script type="text/javascript">
		


		function togEdit(){
			$(".btn_delete").toggle();
			$(".btn_Edit").toggle();
		}


		function queryCode()
		{

              $.ajax({
                type:"post",
                url:"__PUBLIC__/index/udid/udids",
                data:{},
                success:function(res){

				if (typeof res === "string") {
					showData(JSON.parse(res));
				}else{
					showData(res);
				}

                },
                error: function(e) { 
                	alert(e.message); 
              } 
            });
		}


		function showData(obj){
			var dic = obj["data"];
			vm.$data.udids = dic;
			dicCode = dic;
		}

		var vm = new Vue({
			el: "#app",
			data: {
				udids: []
			}
		})

		function copyCode(v)
		{
			var bomID = $(v).data("id");

			var clipboard = new ClipboardJS("#cntCode", {
				text: function() {
					return dicCode[bomID];
				}
			});

			clipboard.on('success', function(e) {
        //console.log(e);
        Toast('复制成功',2000)
    });

			clipboard.on('error', function(e) {
				console.log(e);
				Toast('复制失败',2000)
			});
		}

		queryCode();


	</script>
	<style type="text/css">
	.cntCode{
		padding: 10px;
	}

	.menu{
		position: absolute;
		padding: 10pt 0 0 0;
		top: 0;
		right: 0;
		bottom: 0;
		width: 60pt;
	}
	.menu button{
		width: 55pt;
	}

	img{
		width: 30pt;
		height: 30pt;
	}

	.cntapp{
		background-color: #f2f3f4;
		padding: 0px 0px 5px 0px;
	}

	.card{
		background-color: #fff;
		margin: 0px 0px 5px 0px;
		padding: 5pt;
		position: relative;
	} 

	.title{
		background-color: #ddd;
		font-size: 32px; 
		font-weight: bold; 
		border-bottom-width: 2px;
		border-bottom-style: solid; 
		border-bottom-color: rgb(204, 204, 204); 
		padding: 0px 4px 0px 0px; 
		text-align: left; 
		margin: 0px 0px 10px;
	}
	a{
		font-size: 12pt;
	}

	.copy{
		border: none;
		background-color: #f1f2f3;
		color: #4c90bc;
	}
</style>
</html>